#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
const int N=1e5+5;
int a[N],b[N],ans,n,m,ans1,cnt;
unordered_map<int,int> ma;
bool cmp(int x,int y){
    return x>y;
}
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    m=n;
    ans1=m;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]),b[i]=a[i];
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++){
        if(a[m]<a[i]){
            a[m]=0;
            m--;
        }
    }
    if(n&1){
        if(a[n]<a[1])
            m--;
    }
    cnt=n/2+1;
    for(int i=1;i<=n;i++){
        if(b[cnt]<a[i]){
            ans1--;
            cnt++;
        }
    }
    printf("%d\n",min(ans1,m));
    return 0;
}
